package com.example.nonggo.bean;

import org.json.JSONObject;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class GoodsPriceDTO {
//    {
//    "pageNo": 1,
//    "pageSize": 10,
//    "varietyName": "面粉"
//}

    private int pageNo;
    private int pageSize;
    private String varietyName;

    public GoodsPriceDTO(String varietyName) {
        this.pageNo = 1;
        this.pageSize = 10;
        this.varietyName = varietyName;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public String getVarietyName() {
        return varietyName;
    }

    public void setVarietyName(String varietyName) {
        this.varietyName = varietyName;
    }

    public RequestBody toRequestBody(){
        JSONObject j = new JSONObject();
        try {
            j.put("pageNo", pageNo);
            j.put("pageSize", pageSize);
            j.put("varietyName", varietyName);
        } catch (Exception ignore) {
        }
        return RequestBody.create(MediaType.parse("application/json"), j.toString());
    }
}
